# hook.py
import os
import sys
from PyQt5.QtCore import QCoreApplication


def pyqt5_runtime_hook():
    if getattr(sys, 'frozen', False):
        # 修复Qt插件路径
        QCoreApplication.addLibraryPath(
            os.path.join(sys._MEIPASS, 'PyQt5', 'Qt', 'plugins')
        )

        # 修复C运行时环境
        os.environ['PATH'] = sys._MEIPASS + os.pathsep + os.environ['PATH']